//
//  UIViewController+LZRemoveViewController.m
//  laziz_Consumer
//
//  Created by xbn_iMac on 2017/1/4.
//  Copyright © 2017年 XBN. All rights reserved.
//

#import "UIViewController+LZRemoveViewController.h"

@implementation UIViewController (LZRemoveViewController)

- (void)lz_removeSelfFromNavigation {
    NSMutableArray *vcArrays = [[NSMutableArray alloc]initWithArray:self.navigationController.viewControllers];
    [vcArrays removeObject:self];
    self.navigationController.viewControllers = vcArrays;
}

- (void)lz_removeViewControllersFromNavigationWithFromIndex:(NSInteger)fromIndex andToIndex:(NSInteger)toIndex {
    if (fromIndex>toIndex) {
        return;
    }
    NSMutableArray *vcArrays = [[NSMutableArray alloc]initWithArray:self.navigationController.viewControllers];
    if (vcArrays.count>toIndex) {
        [vcArrays removeObjectsInRange:NSMakeRange(fromIndex, toIndex-fromIndex)];
    }
    
    self.navigationController.viewControllers = vcArrays;
}

@end
